﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using Helper;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
//using System.Web.Script.Serialization;


    /// <summary>
    /// Map 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    [ScriptService]
    public class Map : System.Web.Services.WebService
    {
        public static Helper.MapConfig m_MapConfi = null;
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public string GetMapConfig()
        {
            try
            {
                string op=AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                MapConfig config = MapConfig.Deserialize(op+"YZT\\Map\\Config\\MapConfig.xml");
                if (config != null)
                {
                    config.Layers.Sort();
                    JsonHelper helper = new JsonHelper();
                    JavaScriptSerializer js = new JavaScriptSerializer();
                    string str = helper.ScriptSerialize<MapConfig>(config);
                    return str;
                }
                return "";
            }
            catch (Exception ee){
                return ee.Message;
            }
        }
    }

